/*
 * @Author: fisher
 * @Date: 2024-03-14 15:58:46
 * @LastEditors: fisher luthor-li@qq.com
 * @LastEditTime: 2024-07-22 17:23:57
 * @FilePath: \allfront\src\utils\fpstream\modules\Weather\index.js
 * @Description:
 */
export default class {
  constructor(send2Ue, listen2Ue) {
    this.send2Ue = send2Ue;
    this.listen2Ue = listen2Ue;
    this.baseCmd = "/SkyControl";
  }
  setTime(data, cb) {
    // const { h } = data;
    this.send2Ue(
      `${this.baseCmd}/SetDayTime`,
      {
        Time: parseInt(data) * 100,
      },
      cb
    );
  }
  setTimeByName(name, cb) {
    const timeMap = {
      morning: 7,
      noon: 12,
      evening: 18,
      night: 22,
    };
    const h = timeMap[name] || 10;
    this.send2Ue(
      `${this.baseCmd}/SetDayTime`,
      {
        Time: parseInt(h) * 100,
      },
      cb
    );
  }

  setWeather(data, cb) {
    this.send2Ue(
      `${this.baseCmd}/ChangeWeather`,
      {
        Weather: data,
      },
      cb
    );
  }
}
